﻿<template>
  <a-modal
    :title="title"
    width="40%"
    :visible="visible"
    :confirmLoading="loading"
    @ok="handleSubmit"
    @cancel="()=>{this.visible=false}"
  >
    <a-spin :spinning="loading">
      <a-form-model ref="form" :model="entity" :rules="rules" v-bind="layout">
        <a-form-model-item label="代发批次ID" prop="TBID">
          <a-input v-model="entity.TBID" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="代发编号" prop="PaymentOutBatchNo">
          <a-input v-model="entity.PaymentOutBatchNo" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="订单号" prop="PaymentOutOrderNo">
          <a-input v-model="entity.PaymentOutOrderNo" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="金额" prop="PaymentOutAmount">
          <a-input v-model="entity.PaymentOutAmount" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="收款人姓名" prop="BeneficiaryName">
          <a-input v-model="entity.BeneficiaryName" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="收款人账号" prop="BeneficiaryAccountNumber">
          <a-input v-model="entity.BeneficiaryAccountNumber" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="身份证号码" prop="idCardNo">
          <a-input v-model="entity.idCardNo" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="说明" prop="Description">
          <a-input v-model="entity.Description" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="审核" prop="systemCheck">
          <a-input v-model="entity.systemCheck" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="人员ID" prop="employeeId">
          <a-input v-model="entity.employeeId" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="银行名称" prop="BankName">
          <a-input v-model="entity.BankName" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="charge" prop="charge">
          <a-input v-model="entity.charge" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="交易状态" prop="trxSts">
          <a-input v-model="entity.trxSts" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="上游单号" prop="trxId">
          <a-input v-model="entity.trxId" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="trxCrtTm" prop="trxCrtTm">
          <a-input v-model="entity.trxCrtTm" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="完成日期" prop="trxFnshDtTm">
          <a-input v-model="entity.trxFnshDtTm" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="订单号" prop="ordrId">
          <a-input v-model="entity.ordrId" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="返回信息" prop="sysRtnDesc">
          <a-input v-model="entity.sysRtnDesc" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="取消日期" prop="CancelDate">
          <a-input v-model="entity.CancelDate" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="单笔服务费" prop="fee">
          <a-input v-model="entity.fee" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="是否发送短信" prop="sendsmsstatus">
          <a-input v-model="entity.sendsmsstatus" autocomplete="off" />
        </a-form-model-item>
      </a-form-model>
    </a-spin>
  </a-modal>
</template>

<script>
export default {
  props: {
    parentObj: Object
  },
  data() {
    return {
      layout: {
        labelCol: { span: 5 },
        wrapperCol: { span: 18 }
      },
      visible: false,
      loading: false,
      entity: {},
      rules: {},
      title: ''
    }
  },
  methods: {
    init() {
      this.visible = true
      this.entity = {}
      this.$nextTick(() => {
        this.$refs['form'].clearValidate()
      })
    },
    openForm(id, title) {
      this.init()

      if (id) {
        this.loading = true
        this.$http.post('/Base_leasesystem_transactionbatchsub/leasesystem_transactionbatchsub/GetTheData', { id: id }).then(resJson => {
          this.loading = false

          this.entity = resJson.Data
        })
      }
    },
    handleSubmit() {
      this.$refs['form'].validate(valid => {
        if (!valid) {
          return
        }
        this.loading = true
        this.$http.post('/Base_leasesystem_transactionbatchsub/leasesystem_transactionbatchsub/SaveData', this.entity).then(resJson => {
          this.loading = false

          if (resJson.Success) {
            this.$message.success('操作成功!')
            this.visible = false

            this.parentObj.getDataList()
          } else {
            this.$message.error(resJson.Msg)
          }
        })
      })
    }
  }
}
</script>
